package com.yang.lesson05;

import javax.swing.*;
import java.awt.*;

//可以滚动的面板
public class JScrollDemo extends JFrame {
    public JScrollDemo() {
        //容器
        Container container = this.getContentPane();

        //文本域，可以写多行
        TextArea textArea = new TextArea(20, 5);
        textArea.setText("杨柳");

        //Scroll面板，可以滚动
        JScrollPane scrollPane = new JScrollPane(textArea);
        container.add(scrollPane);

        this.setVisible(true);
        this.setSize(500,500);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    }

    public static void main(String[] args) {
        new JScrollDemo();
    }
}
